
% very simple function that basically stores the pixels to micron
% conversion factors for the different objectives used on the 2p system

function micronsPerPixel = pixel2micron_2p(zoom,objectivetype)

switch objectivetype
    case '25x'      %this is empirically calculated from the combined resoltuion target; last update 2/1/2022
        micronsPerPixel = 400/274.5./zoom;
    case '16x'      %this this is from Vince's approach
        %micronsPerPixel = 1000/512./zoom;        %
        micronsPerPixel = 2.21./zoom;  %this is empirically calculated from the combined resoltuion target; last update 2/2/2022
    case '25x_v2'       %this one is after we switched to scanimage 2022 and reset some of the machine data files
        micronsPerPixel = mean([0.6676,0.4761,0.4743,1.3145,0.2823].*[2,3,3,1,5])./zoom;
    case '16x_v2'       %this one is after we switched to scanimage 2022 and reset some of the machine data files
        micronsPerPixel = mean([0.6676,0.4761,0.4743,1.3145,0.2823].*[2,3,3,1,5])*(25/16)./zoom;
        
end

%263.6pixel - 300 micron
%187 - 200